package com.itmk.web.meteorological_station.service.impl;

import com.itmk.web.meteorological_station.entity.EnvironmentalStation;
import com.itmk.web.meteorological_station.entity.MeteorologicalStation;

import com.itmk.web.meteorological_station.mapper.EnvironmentalStationMapper;
import com.itmk.web.meteorological_station.mapper.MeteorologicalStationMapper;
import com.itmk.web.meteorological_station.service.DataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.List;

@Service
public class DataServiceImpl implements DataService {

    @Autowired
    private EnvironmentalStationMapper environmentalStationMapper;

    @Autowired
    private MeteorologicalStationMapper meteorologicalStationMapper;

    @Override
    public List<EnvironmentalStation> getEnvironmentalDataByVariable(String variableName, Timestamp startDate, Timestamp endDate) {
        // 调用 Mapper 根据变量名、起始时间和结束时间查询
        return environmentalStationMapper.findByVariableAndDate(variableName, startDate, endDate);
    }

    @Override
    public List<MeteorologicalStation> getMeteorologicalDataByVariable(String variableName, Timestamp startDate, Timestamp endDate) {
        // 调用 Mapper 根据变量名、起始时间和结束时间查询
        return meteorologicalStationMapper.findByVariableAndDate(variableName, startDate, endDate);
    }
}
